package com.jy.api.signUpReq;

import com.jy.api.domain.Order;
import com.jy.api.domain.OrderSource;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * Created by xiaohua on 2018/8/8.
 */
@Data
@NoArgsConstructor
public class AdminOrderRes {

    private String orderId;

    private String paymentChannel;


    private Date createTime;


    private double amount;

    private double total;

    private double discount;

    private double removeZero;

    private OrderSource source;

    private String tableNo;

    private String creatorName;

    private String mobile;

    private Date refundTime;

    public AdminOrderRes(Order order) {
        this.orderId = order.getId();
        this.paymentChannel = order.getChannel();
        this.createTime = order.getPaymentTime();
        this.amount = order.getAmount();
        this.total = order.getTotal();
        this.discount = order.getDiscount();
        this.removeZero = order.getRemoveZero();
        this.source = order.getSource();
        this.tableNo = order.getTableNo();
        this.creatorName = order.getCreatorName();
        this.mobile = order.getCreatorId();
        //因为需要处理上班订单退款导致交班数据不准确。增加退款时间
        this.refundTime = order.getRefundTime() == null ? order.getPaymentTime() : order.getRefundTime();
    }

}
